package com.ruoyi.pyo.wechat.config;

import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
import org.springframework.stereotype.Component;

import java.io.Serializable;

/**
 * 项目中需继承此类
 *
 * @author lihen
 */
@Setter
@Getter
@Component
@ConfigurationProperties(prefix = "wechat.conf")
public class WeChatProps implements Serializable {
    /**
     * 默认开启
     */
    private boolean enabled = true;

    /**
     * App ID
     */
    private String appId;
    /**
     * secret
     */
    private String secret;

    /**
     * v3
     */
    @NestedConfigurationProperty
    private V3 v3;


    @Data
    public static class V3 {
        /**
         * Mch ID
         */
        private String mchId;

        /**
         * APIv3 密钥
         */
        private String api3Key;

        private String publicKeyId;
        /**
         * 公钥路径，pub_key.pem
         */
        private String publicKeyPath;
        /**
         * 秘钥路径，apiclient_key.pem
         */
        private String privateKeyPath;
        /**
         * 商户证书序列号
         */
        private String mchSerialNo;

        /**
         * 支付回调地址
         */
        private String notifyPayUrl;

        /**
         * 退款回调地址
         */
        private String notifyRefundUrl;
    }
}
